package com.enjoyor.soa.traffic.restt.tpcms.dubbo.impl;

import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;
import com.enjoyor.soa.traffic.api.service.dubbo.tpcms.IDubboPassCardService;
import com.enjoyor.soa.traffic.restt.tpcms.dubbo.IPassCardConsumeService;
import com.enjoyor.soa.traffic.util.enums.EnumApplyStatus;
import com.enjoyor.soa.traffic.util.pojo.Page;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

/**
 * 审核管理信息
 * 
 * @author fzj 2018年5月4日
 */
@Component
public class PassCardConsumeService implements IPassCardConsumeService {

    @Reference(version = "1.0.0", timeout = 10000)
    private IDubboPassCardService dubboPassCardService;

    /**
     * 删除通行证
     */
    @Override
    public ResultPojo deletePassCard(String passCardId, String userName) {
        return dubboPassCardService.deletePassCard(passCardId, userName);
    }

    /**
     * 通行证延期
     */
    public ResultPojo extensionPassCard(String passCardId, String extensionPeople, String isSelf, String extensionDays,
            String userName) {
        String passStatusId = EnumApplyStatus.ISEXTENSION.getKey();
        return dubboPassCardService.editPassCardStatus(passCardId, passStatusId, extensionPeople, isSelf, extensionDays,
                userName);
    }

    /**
     * 通行证打印
     */
    public ResultPojo printPassCard(String passCardId, String userName) {
        String passStatusId = EnumApplyStatus.ISPRINT.getKey();
        return dubboPassCardService.editPassCardStatus(passCardId, passStatusId, null, null, null, userName);
    }

    /**
     * 查询通行证列表信息List
     */
    @Override
    public ResultPojo getPassCardList(String passCardId, String passApplyId, String effectStartTime,
            String effectEndTime, String passStatusId) {
        return dubboPassCardService.getPassCardList(passCardId, passApplyId, effectStartTime, effectEndTime,
                passStatusId);
    }

    /**
     * 查询当年通行证最大编号
     */
    public String getMaxPassCardId() {
        return (String) dubboPassCardService.getMaxPassCardId().getResultList();
    }

    /**
     * 查询通行证分页信息
     */
    @SuppressWarnings("rawtypes")
    @Override
    public ResultPojo getPassCardPage(Page page) {
        return dubboPassCardService.getPassCardPage(page);
    }

}
